package starter.tool;

import java.io.IOException;

public class MacExec {
	static final Runtime rt = Runtime.getRuntime();

	public static Process exec(String cmd) throws IOException {
		System.out.println(cmd);
		return rt.exec(cmd);
	}

	public static void copyFile(String src, String dest) throws Exception {
		String cmd = String.format("cp %s %s", src, dest);
		exec(cmd);
	}

	public static void delFolder(String path) throws Exception {
		String cmd = String.format("rm -rf %s", path);
		exec(cmd);
	}

	public static void copyFolder(String src, String dest) throws Exception {
		String cmd = String.format("cp -R %s %s", src, dest);
		exec(cmd);
	}

	public static void main(String[] args) throws Exception {
		String src = "/Users/zhangrenzhi/Documents/workspace.sojoys/coh.core/src/";
		String dest = "/Users/zhangrenzhi/Desktop/tmp/";
		copyFolder(src, dest);
	}

}
